﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using Numbers;

namespace Numbers
{
    /// <summary>
    /// Unlike other quanities out there - this is a single quantity
    /// that is read only. It depends on others, but nothing it does will
    /// ever drive anything else.
    /// 
    /// Given a numerator and a denomenator, it calculates what the resulting c+l ratio is.
    /// 
    /// </summary>
    public class epsilon_12 : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// A real value that returns what we want to look at. Useful because the rest
        /// of the system knows how to speak in this language.
        /// </summary>
        public Value ValueValue { get; private set; }

        /// <summary>
        /// Create the esp monitoring object.
        /// </summary>
        /// <param name="num_2"></param>
        /// <param name="denom_2"></param>
        public epsilon_12(FlavorSample num, FlavorSample denom)
        {
            ValueValue = new Numbers.Value();

            Numbers.Arithmatic.Division.Create(new Numbers.Arithmatic.Operand(ValueValue),
                new Numbers.Arithmatic.Operand(num.LightCharmValue, true),
                new Numbers.Arithmatic.Operand(denom.LightCharmValue, true));

            ValueValue.PropertyChanged += new PropertyChangedEventHandler(ValueValue_PropertyChanged);
        }

        /// <summary>
        /// Notify property changing!
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ValueValue_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            OnPropertyChanged("Value");
        }

        /// <summary>
        /// Fire the event if need be.
        /// </summary>
        /// <param name="propName"></param>
        private void OnPropertyChanged(string propName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propName));
            }
        }

        /// <summary>
        /// Access the current value of this eps 12 calculation
        /// </summary>
        public double Value { get { return ValueValue.Val; } }
    }
}
